Conversation
Split the monolithic system_configurator.py into a package for better organization as more configurators are added. base.py has the ABC and helpers, clock_sync.py has ClockSyncConfigurator, lcm.py has LCM configurators. __init__.py re-exports everything for backward compat.
Drop requirements.py and its tests — the global_config-based connection type check was unnecessary. Blueprints now call system_checks(ClockSyncConfigurator()) directly.
…n.py Replace 6 scattered duration/byte formatting implementations with two shared functions: human_duration() and human_bytes().
Replace hardcoded timedatectl + systemd-timesyncd with a fallback chain: ntpdate > sntp > date -s. Avoids touching systemd on systems where timesyncd isn't installed (e.g. Arch). Also removes duplicate warning printed from check() (explanation() already handles it).
Move msgs/sec formatter from benchmark heatmap into dimos/utils/human.py as human_number() (42, 1.5k, 3.2M).
Greptile SummaryThis PR adds automated clock synchronization checks for Unitree WebRTC deployments and consolidates human-readable formatters across the codebase. Key Changes:
Breaking Changes (intentional):
Testing:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Blueprint.requirements] --> B[system_checks wrapper]
B --> C[configure_system]
C --> D{CI environment?}
D -->|Yes| E[Skip all checks]
D -->|No| F[Run ClockSyncConfigurator.check]
F --> G{NTP query}
G -->|Timeout/Error| H[Pass gracefully]
G -->|Success| I{abs offset > 100ms?}
I -->|No| J[Pass]
I -->|Yes| K[Show explanation]
K --> L{User approves fix?}
L -->|No non-critical| M[Continue with warning]
L -->|Yes| N[Run fix chain]
N --> O{Platform?}
O -->|Linux| P[ntpdate > sntp > date -s]
O -->|macOS| Q[sntp -sS]
P --> R[Blueprint starts]
Q --> R
J --> R
H --> R
M --> R
Last reviewed commit: f2c499b |
| if configurators: | ||
| try: | ||
| configure_system(configurators) | ||
| except SystemExit: | ||
| labels = [type(c).__name__ for c in configurators] | ||
| print( | ||
| f"Required system configuration was declined: {', '.join(labels)}", | ||
| file=sys.stderr, | ||
| ) | ||
| sys.exit(1) | ||
|
|
There was a problem hiding this comment.
configuring and checking requirements seem different. I think you should add:
autoconnect(
...
).configurators(SystemConfigurator())
There was a problem hiding this comment.
I considered this and it would have been easier but I always like to have less categories then more.
I consider this a category of "function you call - it does either checks or config, if it errors out stuff is not good to run" so this can be pings, clock, network checks, LFS checks etc. From a blueprint perspective that's the way you want to think about the category imo, no need to know what's inside the functions.
Only ugliness here is that configurators are not functions but these classes. I considered keeping the wrapper to turn them into functions external to blueprints.py but this complicates the user facing API.
like
blueprint.requirements(configurator(Clock, Network)) There are a few more things with configurators to refactor, I'd like to turn them info functions, so I expect this code to go away from blueprints.. how does this sound?
…rator Addresses PR review feedback: replace manual input() with typer.confirm() and all print() calls with proper logging.
The doclinks pre-commit hook needs to run on markdown changes too.
…onfigurator # Conflicts: # dimos/robot/cli/dimos.py
Problem
Closes #1344
Closes DIM-575
When running Unitree robots over WebRTC, clock drift between the host and robot causes timestamp mismatches. There was no automated check or fix for this.
Solution
ClockSyncConfiguratorpure py SNTP query detects clock offset (threshold: ±100ms). NTP unreachable -> gracefully warns (works offline). triesntpdate>sntp>date -sfallback.system_checks()bridge - wrapsSystemConfigurator(s) into aBlueprint.requirements()compatible callablesystem_configuratorrefactored into a package -base.py(framework),lcm.py(multicast/buffer),clock_sync.py(new).dimos/utils/human.py- consolidated 6 scattered duration/byte/number formatters intohuman_duration(),human_bytes(),human_number().Integrated into
unitree_go2_basicandunitree_g1_basichardware blueprints.Breaking Changes
None
How to Test
Issues
configurator API needs some improvements
Contributor License Agreement